import React from 'react';
import { Consumer } from "./Context";//引入父组件的Consumer容器
function Grandson(props) {
    return (
         //Consumer容器,可以拿到上文传递下来的name属性,并可以展示对应的值
        <Consumer>
            {(data ) =>
                   <div className="grandson">
                   <p>孙组件:获取传递下来的值:{data.grandson}</p>
               </div>
            }
        </Consumer>
    );
}
export default Grandson;